package com.hava.demo.springmvc.account.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by zhanpeng on 15-3-23.
 */
@Controller
@RequestMapping(value = "/account/signin")
public class SignInController {

    @RequestMapping(method = RequestMethod.GET)
    public String login() {
        return "account/signin";
    }

    @RequestMapping(method = RequestMethod.POST)
    public String login(HttpServletRequest request) {
        
        System.out.println("account signin");
        String inputEmail = request.getParameter("username").trim();
        System.out.println(inputEmail);
        String inputPassword = request.getParameter("password").trim();
        System.out.println(inputPassword);
        
        //check username and password
        
        //goto the context page

        //redirect 在浏览器跳转
        return "redirect:/demo/manager/frame";
    }
}